<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>发布帖子-卷云户外</title>
<script src="../js/common/push.js"></script>
<script src="../js/common/jquery.min.js" type="text/javascript"></script>
<script src="../js/common/jquery.superslide.js" type="text/javascript"></script>
<script src="../js/common/pace.js" type="text/javascript"></script>
<script src="../js/common/common.js" type="text/javascript"></script>
<script src="../js/common/forum.js" type="text/javascript"></script>
<script src="../js/common/jquery.superslide.js" type="text/javascript"></script>

<link rel="stylesheet" type="text/css" href="../css/common/style_2_common.css">
<link rel="stylesheet" type="text/css" href="../css/common/style_2_forum_index.css">
<link rel="stylesheet" type="text/css" href="../css/common/public.css">
<link rel="stylesheet" type="text/css" href="../css/common/head.css">
<link rel="stylesheet" id="css_widthauto" type="text/css" href="../css/common/style_2_widthauto.css">
<script src="../js/layer/layer.js"></script>
<%-- kindeditor 引入 --%>
<link rel="stylesheet" type="text/css" href="../kindeditor-4.1.10/css/layout.css">
<link rel="stylesheet" href="../kindeditor-4.1.10/themes/default/default.css" />
<link rel="stylesheet" href="../kindeditor-4.1.10/plugins/code/prettify.css" />
<script charset="utf-8" src="../kindeditor-4.1.10/kindeditor.js">
</script>
<script charset="utf-8" src="../kindeditor-4.1.10/lang/zh_CN.js">
</script>
<script charset="utf-8" src="../kindeditor-4.1.10/plugins/code/prettify.js">
</script>
<script>
	function windowDispatch(){
		location.href = "login.jsp";
	}	
	
	function check(){
		var flag = true;
		var title = jQuery("#mainContent input[type='text']").val();
		var content = jQuery("#mainContent textarea[name='content']").val();
		
		if('${session.user}' == null || '${session.user}' == ""){
			layer.open({
			title: '消息',
			content: '请先登录！',
			icon:0
			}); 
			setTimeout("windowDispatch()", 2000 );
			return false;
		}
		if(title==""){
			layer.open({
			title: '消息',
			content: '题目不能为空',
			icon:0
			}); 
			flag = false;
			return false;
		}
		if(content==""){
			layer.open({
			title: '消息',
			content: '内容不能为空',
			icon:0
			}); 
			flag = false;
			return false;
		}
		return flag;
	}

	KindEditor.ready(function(K) {
		var editor1 = K.create('textarea[name="content"]', {
			cssPath : '../kindeditor-4.1.10/plugins/code/prettify.css',
			uploadJson : '../kindeditor-4.1.10/jsp/upload_json.jsp',
			fileManagerJson : '../kindeditor-4.1.10/jsp/file_manager_json.jsp',
			allowFileManager : true,
			allowImageUpload : true,
			items : [
				'source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
				'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
				'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
				'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
				'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
				'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
				'flash', 'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
				'anchor', 'link', 'unlink'
			],
			afterCreate : function() {
				var self = this;
				K.ctrl(document, 13, function() {
					self.sync();
					document.forms['example'].submit();
				});
				K.ctrl(self.edit.doc, 13, function() {
					self.sync();
					document.forms['example'].submit();
				});
			}
		});
		prettyPrint();
	});
</script>
<style>
	
	.postRelease{
		margin:40px auto;width:1030px;
	}
	#mainContent{font-size: 14px;margin-top: 10px}
	#mainContent input[type="submit"]{
		background: #37B8EB;height:28px;line-height: 28px;padding: 0 15px;color:white
	}
	#mainContent input[type="text"]{
		width:300px;
		padding: 4px 4px;
	    line-height: 18px;
	    border: 1px solid #CCC;
	    background-color: white;
	    box-shadow: 2px 2px 2px #F0F0F0 inset;
	    vertical-align: middle;
	    margin: 0;
	    font-family: inherit;
	    color: #333333;
	}
</style>
</head>

<body>
	<%--	公共头部	 --%>
	<jsp:include page="indexHead.jsp"></jsp:include>
	<div class="postRelease">
		<div class="z" style="font-size: 14px;float: none">
			<a href="index.jsp">论坛</a> <em>›</em>
			<a href="PostAction_getPageResult.action?pagenum=1&topicId=${session.topicId }">${session.topicName }</a> <em> ›</em> 
			发表帖子
		</div>
		
		<div id="mainContent">
			<form name="example" method="post" action="PostAction_release.action" onsubmit="return check()">
				题目： <input type="text" name="title" autocomplete="off" /> <br />
				内容：
				<textarea name="content" cols="150" rows="20" autocomplete="off"></textarea><br />
				<input type="hidden" value="${topicId }" name="topicId"/>
				<input type="hidden" value="${session.user.id }" name="userId"/>
				<input type="submit" name="button" value="提交" />
				(提交快捷键:Ctrl + Enter)
			</form>
		</div>
		
	</div>
	<%--	公共底部	 --%>
	<jsp:include page="indexFooter.jsp" />
</body>
</html>
